var pid;
window.onload = function () {
    pid = getQuery("id");
    findById();
}

function findById() {
    axios.get("/product/findById", {
        params: {
            id: pid
        }
    }).then(resp => {
        var info = resp.data;
        $("nameSpan").innerHTML = info.name
        $("dateSpan").innerHTML = info.creatDate
        $("priceTxt").value=info.price
    });
}
function update(){
    axios.get("/product/update",{
        params: {
            id:pid,
            price:$("priceTxt").value
        }
    }).then(resp =>{
        if(resp.data == "ok"){
            location.href = "/product/main.html";
        }
    })
}